package restless.restlessAssets.splash.restless {
	
	import com.greensock.TweenMax;
	import restless.core.gameObjs.RLEBlitMC;
	import com.greensock.easing.*;
	
	/**
	 * @author Jordan Laine
	 */
	
	public class RestlessSplash extends RLEBlitMC {
		
		private var bkg:RLEBlitMC;
		
		public function RestlessSplash() {
			setRE();
			switchGFX(gfxM.getBDV("rleSplashGFX"));
			sID = "RLESplash";
			
			mousePriority = 1;
			
			updating = true;
			rendering = true;
			leftClick = true;
			rightClick = true;
			timers = true;
			backgroundObj = false;
			
			layer = 0;
			x = -width + screenM.width;
			//y = 100;
			tween = TweenMax.to(this, 2.5, { x:0, ease:Sine.easeOut } );
			//setRect(tempV3DPoint.x, tempV3DPoint.y, screenM.width, screenM.height);
			//center = true;
			//bitmapSizedRender = false;
			
			addTickTimer("this", stage.frameRate * 3.5);
			
			bkg = new RLEBlitMC();
			bkg.setRE();
			bkg.sID = "MNS Splash BKG";
			bkg.switchGFXMC(new splashBKG);
			bkg.updating = true;
			bkg.backgroundObj = true;
		}
		
		override public function executeTimer(id:String):void {
			nextState(false);
		}
		
		override public function mClickR():void {
			nextState(true);
		}
		
		override public function mClickL():void {
			nextState(true);
		}
		
		
		private function nextState(click:Boolean):void {
			bkg.dispose();
			tween.kill();
			bkg = null;
			if (click) {
				statM.addToStat("MNSSkippedIntro", 1);
			} else {
				statM.addToStat("MNSNotSkipped", 1);
			}
			RE.advanceSystemState();
			
		}
		
	}

}